package hcs.settings;

import hcs.interfaces.IHouseSettings;

import java.io.File;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;

public class HouseSettings {
	
	static String settings = "etc/settings.xml";
	
	public static IHouseSettings getHouseSettings() {
		IHouseSettings ret = null;
		try {
		    DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
		    Document document = parser.parse(new File(settings));
		    ret = new XMLSettings(document);
		} catch (Exception e) {
			e.printStackTrace();
			ret = new DefaultHouseSettings();
			System.err.println(e.getMessage());
		}
		return ret;
	}
}
